package com.woniuxy.credit_loans.product_liu.service.impl;

import com.woniuxy.credit_loans.entity.Product;
import com.woniuxy.credit_loans.entity.ProductApp;
import com.woniuxy.credit_loans.mapper.ProductAppMapper;
import com.woniuxy.credit_loans.mapper.ProductMapper;
import com.woniuxy.credit_loans.product_liu.dto.ProductAppDto;
import com.woniuxy.credit_loans.product_liu.service.ProductAppService;
import com.woniuxy.credit_loans.product_liu.vo.ProductAppVo;
import org.apache.poi.hpsf.Decimal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class ProductAppServiceImpl implements ProductAppService {
    @Autowired
    private ProductAppMapper productAppMapper;
    @Autowired
    private ProductMapper productMapper;

    @Override
    public int insertByBankName(ProductAppDto productAppDto) {
        return productAppMapper.insertByBankName(productAppDto);
    }

    @Override
    public int insertSelective(ProductApp record) {
        record.setProductappFlag(1);
        Date date = new Date();
        SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd");
        String format = simpleDateFormat.format(date);
        record.setProductappDate(format);
        return productAppMapper.insert(record);
    }

    @Override
    public List<ProductAppVo> selectAllProductApp() {
        return productAppMapper.selectAllProductApp();
    }


    @Override
    public ProductApp selectByPrimaryKey(Integer id) {
        return productAppMapper.selectByPrimaryKey(id);
    }

    @Override
    public ProductApp selectById(Long id) {
        return productAppMapper.selectById(id);
    }

    @Override
    public int updateByPrimaryKeySelective(ProductApp record) {
        return productAppMapper.updateByPrimaryKeySelective(record);
    }
}
